package com.ruoyi.client.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.ruoyi.client.domain.entity.BlogOper;
import com.ruoyi.client.domain.vo.OperVo;
import com.ruoyi.client.service.IBlogOperService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.web.core.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("client/user/oper")
public class BlogOperController extends BaseController {
    @Autowired
    IBlogOperService operService;

    /**
     * 获取最近的操作记录
     * @return
     */
    @RequestMapping("lately")
    public R<List<OperVo>> getLately(){
        Long userId = Long.valueOf((String) StpUtil.getLoginId());
        List <OperVo> result = operService.getLatelyByUserId(userId);
        return R.ok(result);
    }
}
